/***************************************************************
 * Name:      MachInfoMain.cpp
 * Purpose:   Code for Application Frame
 * Author:    iNemesis (zhk_xbox@163.com)
 * Created:   2011-10-31
 * Copyright: iNemesis ()
 * License:
 **************************************************************/

#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__

#include "MachInfoMain.h"
#include "wx/msgdlg.h"

//helper functions
enum wxbuildinfoformat
{
  short_f, long_f
};

wxString wxbuildinfo(wxbuildinfoformat format)
{
  wxString wxbuild(wxVERSION_STRING);

  if (format == long_f )
  {
#if defined(__WXMSW__)
    wxbuild << _T("-Windows");
#elif defined(__WXMAC__)
    wxbuild << _T("-Mac");
#elif defined(__UNIX__)
    wxbuild << _T("-Linux");
#endif

#if wxUSE_UNICODE
    wxbuild << _T("-Unicode build");
#else
    wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
  }

  return wxbuild;
}


MachInfoFrame::MachInfoFrame(wxFrame *frame)
  : GUIFrame(frame)
{
#if wxUSE_STATUSBAR
  statusBar->SetStatusText(_("Hello Code::Blocks user!"), 0);
  statusBar->SetStatusText(wxbuildinfo(short_f), 1);
#endif
}

MachInfoFrame::~MachInfoFrame()
{
}

void MachInfoFrame::OnRebuild(wxCommandEvent& event)
{
  Destroy();
}

void MachInfoFrame::OnLogin(wxCommandEvent &event)
{
  Destroy();
}

void MachInfoFrame::OnClose(wxCloseEvent &event)
{
  Destroy();
}

void MachInfoFrame::OnQuit(wxCommandEvent &event)
{
  Destroy();
}

void MachInfoFrame::OnAbout(wxCommandEvent &event)
{
  wxString msg = wxbuildinfo(long_f);
  wxMessageBox(msg, _("Welcome to..."));
}
